# -*- coding: utf-8 -*-
# @author: wch
# @file: imwrite.py
# @time: 2023/1/30 13:49

import cv2

cv2.namedWindow("img", cv2.WINDOW_NORMAL)

img = cv2.imread(r"E:\dyk\opencvedu\media\1.jpg")

while True:
    cv2.imshow("img", img)
    key = cv2.waitKey(0)
    if (key & 0xFF) == ord("q"):
        break
    elif (key & 0xFF) == ord("s"):
        cv2.imwrite(r"E:\dyk\opencvedu\media\1.png", img)
    else:
        print(key)
cv2.destroyAllWindows()
